<?php
namespace app\models;


use yii\base\Model;
use Yii;

/**
 * Signup form
 */

class UploadForm extends Model
{
    public $file;



    /**
     * @inheritdoc
     */

    public function rules()
    {
        return [
         /*   [['type'],'in', 'range' => [1, 2],'message'=>'请选择申请账号类型'],
            [['name','identity_card'], 'checkperson'],
            [['company_id','park_id'],'integer'],
            [['imageFile','imageFile2'], 'file', 'skipOnEmpty' => false, 'extensions' => 'png, jpg'],*/
            [['file'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg'],
        ];
    }

    public function upload()
    {
        if ($this->validate()) {
            $this->file->saveAs('uploads/' . $this->file->baseName . time() .'.' . $this->file->extension);
            return true;
        } else {
            return false;
        }
    }



}
